Filtering Legacy ID between braces

I have a set of requirements in the the following format:

Blah Blah shall Blah Blah black sheep {1590} {Inspect, SE=False}

The first set of braces numbered is the legacy ID that needs to be pulled from the requirement and deleted from the object. The second set of braces are ancillary comments that don't need to be touched at the moment. 

What I was able to parse from the search of the forum is the script below. The problem being the second set of braces.

 

Object o = current
string s = richText(o."Object Text")
 
Regexp rx = regexp2 "\\{(.+)\\}"
if ( rx s)
{
o."Legacy ID" =  s [match 1]
s = s[0:start 0 - 1] s[end 0 + 1:]
o."Object Text" = richText s
}
delete rx

LateandAnnoyed - Tue Nov 07 10:07:42 EST 2017

Re: Filtering Legacy ID between braces
LateandAnnoyed - Fri Nov 17 13:53:55 EST 2017

Working through this a bit morel; its clear that the text I am looking for is not rich text. 
What I have at the moment is wrong, but it's probably clearer.

int detect_brace( const char*str
int offset=0
int str_len=0
char open = '{'
char close = '}')
 
openBrace = findPlainText (obj."Object Text""", open, offset, length, false);
closeBrace = findPlainText (obj."Object Text""", close, offset, length, false);
 
string insideBraces = [openBrace+1 : closeBrace-1]
print insideBraces

 

with this all I am asking it to do it to print what exists inside the braces. 

What am I missing?